<?php


namespace app\admin\validate;


use think\Validate;

class Content extends Validate
{
    protected $rule = [
        'category_name' => 'require|unique:content_category',
        'id'=>'require',
        'title'=> 'require|unique:content',
        'content'=>'require',
        'sort'=>'require'
    ];
    protected $message = [
        'category_name' => '分类名必须',
        'category_name.unique' => "分类名不能重复",
        'id'=>'传入的ID为空',
        'title' => '文章名字必须填写',
        'title.unique' => "文章名字不能重复",
        'content'=>'内容不能为空',
        'sort'=>'排序不能为空'
    ];

    protected $scene = [
        'category_add' => ["category_name"],
        'category_find' => ['id'],
        'category_update' => ["category_name",'id'],
        'content_add'=>['title','content'],
        'content_update'=>['title','content','id'],
        'content_remove'=>['id'],
        'content_sort'=>['id','sort']
    ];
}